
function getValueList(data) {
  const keys = Object.keys(data)
  return keys.map(key => {
    return {
      label: data[key],
      value: parseInt(key)
    }
  })
}

// 教育字段
const educationFields = [
  {
    name: '开始时间',
    field: 'admissionTime',
    formType: 'date',
    setting: []
  },
  {
    name: '结束时间',
    field: 'graduationTime',
    formType: 'date',
    setting: []
  },
  {
    name: '毕业院校',
    field: 'graduateSchool',
    formType: 'text',
    setting: []
  },
  {
    name: '学历',
    field: 'education',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '小学',
      value: 1
    }, {
      label: '初中',
      value: 2
    }, {
      label: '高中',
      value: 3
    }, {
      label: '中专',
      value: 4
    }, {
      label: '大专',
      value: 5
    }, {
      label: '大学',
      value: 6
    }, {
      label: '硕士研究生',
      value: 7
    }, {
      label: '博士研究生',
      value: 8
    }, {
      label: '无',
      value: 0
    }]
  },
  {
    name: '学位',
    field: 'degree',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '学士',
      value: 1
    }, {
      label: '硕士',
      value: 2
    }, {
      label: '博士',
      value: 3
    }]
  },
  {
    name: '专业',
    field: 'major',
    formType: 'text',
    setting: []
  },
  {
    name: '教育形式',
    field: 'teachingMethods',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '普通全日制',
      value: 1
    }, {
      label: '脱产',
      value: 2
    }, {
      label: '远程教育',
      value: 3
    }, {
      label: '自学考试',
      value: 4
    }, {
      label: '函授',
      value: 5
    }, {
      label: '业余',
      value: 6
    }, {
      label: '非全日制',
      value: 7
    }]
  },
  {
    name: '证明人及联系方式',
    field: 'witness',
    formType: 'text',
    setting: []
  }
]

const educationValue = {
  1: '小学',
  2: '初中',
  3: '高中',
  4: '中专',
  5: '大专',
  6: '大学',
  7: '硕士研究生',
  8: '博士研究生',
  0: '无',
}

const teachingMethodsValue = {
  1: '普通全日制',
  2: '脱产',
  3: '远程教育',
  4: '自学考试',
  5: '函授',
  6: '业余',
  7: '非全日制',
}

const degreeMethodsValue = {
  1: '学士',
  2: '硕士',
  3: '博士',
  9: '其他'
}

const isFirstDegreeValue = {
  1: '是',
  0: '否'
}

// 教育验证规则
const educationRules = {
  education: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  teachingMethods: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  graduateSchool: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  major: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  isFirstDegree: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

// 教育model
export const educationModel = {
  fields: educationFields,
  rules: educationRules,
  educationValue,
  teachingMethodsValue,
  isFirstDegreeValue,
  degreeMethodsValue
}

// 工作字段
const workFields = [
  {
    name: '工作单位',
    field: 'workUnit',
    formType: 'text',
    setting: []
  },
  {
    name: '职务',
    field: 'post',
    formType: 'text',
    setting: []
  },
  {
    name: '开始时间',
    field: 'workStartTime',
    formType: 'date',
    setting: []
  },
  {
    name: '结束时间',
    field: 'workEndTime',
    formType: 'date',
    setting: []
  },
  {
    name: '部门',
    field: 'depot',
    formType: 'text',
    setting: []
  },
  {
    name: '证明人及联系方式',
    field: 'witness',
    formType: 'text',
    setting: []
  },
]

import {
  regexIsCRMMobile
} from '@/utils'
import { isEmpty } from '@/utils/types'
const validateCRMMobile = (rule, value, callback) => {
  if (isEmpty(value) || regexIsCRMMobile(value)) {
    callback()
  } else {
    callback(new Error('手机格式有误'))
  }
}

// 工作验证规则
const workRules = {
  workUnit: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  post: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  witnessPhone: [
    {
      validator: validateCRMMobile,
      trigger: ['blur', 'change']
    }
  ]
}

// 工作model
export const workModel = {
  fields: workFields,
  rules: workRules
}

// 证书字段
const certificateFields = [
  {
    name: '职（执）业资格名称',
    field: 'certificateName',
    formType: 'autocomplete',
    placeholder: '请输入',
    setting: [{
      label: '注册会计师',
      value: '注册会计师'
    }, {
      label: '营销专员',
      value: '营销专员'
    }, {
      label: '人力资源专员',
      value: '人力资源专员'
    }, {
      label: '计算机技术专家',
      value: '计算机技术专家'
    }, {
      label: '软件工程师',
      value: '软件工程师'
    }, {
      label: '医疗信息技术专家',
      value: '医疗信息技术专家'
    }]

  },
  {
    name: '职（执）业资格级别',
    field: 'certificateLevel',
    formType: 'text',
    setting: []
  },

  {
    name: '资格取得时间',
    field: 'issuingTime',
    formType: 'date',
    setting: []
  }
]
// 证书验证规则
const certificateRules = {
  certificateName: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ]
}

// 专业技术资格字段
const technicalFields = [
  {
    name: '专业技术资格',
    field: 'technicalName',
    formType: 'autocomplete',
    placeholder:'请输入',
    setting: [{
      label: '高教教师',
      value: '高教教师'
    }, {
      label: '主任药师',
      value: '主任药师'
    }, {
      label: '国家级教练',
      value: '国家级教练'
    }, {
      label: '一级特技美术设计师',
      value: '一级特技美术设计师'
    }, {
      label: '一级律师',
      value: '一级律师'
    }, {
      label: '高级讲师',
      value: '高级讲师'
    }]

  },
  {
    name: '资格级别',
    field: 'technicalLevel',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '正高级',
      value: '正高级'
    }, {
      label: '副高级',
      value: '副高级'
    }, {
      label: '中级',
      value: '中级'
    }, {
      label: '助理级',
      value: '助理级'
    }, {
      label: '员级',
      value: '员级'
    }, {
      label: '无',
      value: '无'
    }]
  },
  {
    name: '资格取得时间',
    field: 'techCertificateTime',
    formType: 'date',
    setting: []
  },
  {
    name: '是否聘任',
    field: 'isEngage',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '是',
      value: '是'
    }, {
      label: '否',
      value: '否'
    }]
  },
  {
    name: '聘任期限(年)',
    field: 'engageTerm',
    formType: 'number',
    setting: []
  }

]
// 专业技术资格规则
const technicalRules = {
  technicalName: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  techCertificateTime: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

// 专业技术工人证书字段
const specialWorkerFields = [
  {
    name: '专业技术工人证书名称',
    field: 'specialWorkerName',
    formType: 'text',
    setting: []

  },
  {
    name: '证书等级',
    field: 'specialWorkerLevel',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '高级技师',
      value: '高级技师'
    }, {
      label: '技师',
      value: '技师'
    }, {
      label: '高级工',
      value: '高级工'
    }, {
      label: '中级工',
      value: '中级工'
    }, {
      label: '初级工',
      value: '初级工'
    }, {
      label: '无',
      value: '无'
    }]
  },
  {
    name: '证书取得时间',
    field: 'issuingTime',
    formType: 'date',
    setting: []
  }

]
// 专业技术资格规则
const specialWorkerRules = {
  specialWorkerName: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ],
  specialWorkerLevel: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  issuingTime: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

// 兼职字段
const concurrentPostFields = [
  {
    name: '兼职机构全称',
    field: 'parentDeptId',
    formType: 'structure',
    props: {
      dataType: 'hrm'
    },
    request: hrmDeptQueryTreeListAPI,
    setting: []
  },
  {
    name: '部门',
    field: 'deptId',
    formType: 'structure',
    props: {
      dataType: 'hrm'
    },
    request: hrmDeptQueryTreeListAPI,
    setting: []
  },
  {
    name: '在岗状态',
    field: 'entryStatus',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '在岗',
      value: '在岗'
    }, {
      label: '离休',
      value: '离休'
    }, {
      label: '退休',
      value: '退休'
    }, {
      label: '内退',
      value: '内退'
    }, {
      label: '不在岗',
      value: '不在岗'
    }, {
      label: '借调',
      value: '借调'
    }, {
      label: '跟班学习',
      value: '跟班学习'
    }, {
      label: '离职',
      value: '离职'
    }]
  },
  {
    name: '职务',
    field: 'post',
    formType: 'text',
    setting: []
  },
  {
    name: '任职日期',
    field: 'entryTime',
    formType: 'date',
    setting: []
  },
  {
    name: '入司时间',
    field: 'companyAgeStartTime',
    formType: 'date',
    setting: []
  },
  {
    name: '是否占编',
    field: 'isOccupy',
    formType: 'select',
    clearable: true,
    setting: [{
      label: '是',
      value: '是'
    }, {
      label: '否',
      value: '否'
    }]
  }
]

// 专业技术资格规则
const concurrentPostRules = {
  parentDeptId: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  deptId: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  entryStatus: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ],
  post: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ]
}

// 兼职model
export const concurrentPostModel = {
  fields: concurrentPostFields,
  rules: concurrentPostRules
}

// 证书model
export const certificateModel = {
  fields: certificateFields,
  rules: certificateRules
}

// 专业技术资格model
export const technicalModel = {
  fields: technicalFields,
  rules: technicalRules
}

// 专业技术工人证书model
export const specialWorkerModel = {
  fields: specialWorkerFields,
  rules: specialWorkerRules
}

/** *** */
// 培训字段
const trainingFields = [
  {
    name: '培训课程',
    field: 'trainingCourse',
    formType: 'text',
    setting: []
  },
  {
    name: '培训机构名称',
    field: 'trainingOrganName',
    formType: 'text',
    setting: []
  },
  {
    name: '培训开始时间',
    field: 'startTime',
    formType: 'date',
    setting: []
  },
  {
    name: '培训结束时间',
    field: 'endTime',
    formType: 'date',
    setting: []
  },
  {
    name: '培训时长',
    field: 'trainingDuration',
    formType: 'number',
    setting: []
  },
  {
    name: '培训成绩',
    field: 'trainingResults',
    formType: 'text',
    setting: []
  },
  {
    name: '培训证书名称',
    field: 'trainingCertificateName',
    formType: 'text',
    setting: []
  },
  {
    name: '培训备注',
    field: 'remarks',
    formType: 'textarea',
    setting: []
  }
]
// 培训验证规则
const trainingRules = {
  trainingCourse: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ]
}

// 培训model
export const trainingModel = {
  fields: trainingFields,
  rules: trainingRules
}

/** *** */
// 联系人
const contactsFields = [
  {
    name: '成员关系',
    field: 'contactsOrganName',
    formType: 'text',
    setting: []
  },
  {
    name: '家庭成员姓名',
    field: 'contactsName',
    formType: 'text',
    setting: []
  },
  {
    name: '民族',
    field: 'nation',
    formType: 's',
    setting: []
  },
  {
    name: '政治面貌',
    field: 'politicalOutlook',
    formType: 'text',
    setting: []
  },
  {
    name: '技术职称',
    field: 'technicalTitle',
    formType: 'text',
    setting: []
  },
  {
    name: '工作单位',
    field: 'workUnit',
    formType: 'text',
    setting: []
  },
  {
    name: '职务',
    field: 'contactsDuration',
    formType: 'text',
    setting: []
  }
]
// 联系人验证规则
const contactsRules = {
  contactsName: [
    { required: true, message: '请输入', trigger: ['blur', 'change'] }
  ]
}

// 联系人model
export const contactsModel = {
  fields: contactsFields,
  rules: contactsRules
}

/** *** */
// 员工model

// 性别 值
const sexValue = {
  1: '男',
  2: '女'
}

// 生日类型 值
const birthdayTypeValue = {
  1: '阳历',
  2: '农历'
}

const sexSetting = [{
  label: '男',
  value: 1
}, {
  label: '女',
  value: 2
}]

// 证件类型
const idTypeValue = {
  1: '身份证',
  2: '港澳通行证',
  3: '台湾通行证',
  4: '护照',
  5: '其他'
}

const idTypeSetting = [{
  label: '身份证',
  value: 1
}, {
  label: '港澳通行证',
  value: 2
}, {
  label: '台湾通行证',
  value: 3
}, {
  label: '护照',
  value: 4
}, {
  label: '其他',
  value: 5
}]

// 聘用形式
const employmentFormsValue = {
  1: '正式',
  2: '非正式'
}

const employmentFormsSetting = [{
  label: '正式',
  value: 1
}, {
  label: '非正式',
  value: 2
}]

// 试用期
const probationValue = {
  0: '无试用期',
  1: '1个月',
  2: '2个月',
  3: '3个月',
  4: '4个月',
  5: '5个月',
  6: '6个月'
}

const probationSetting = [{
  label: '无试用期',
  value: 0
}, {
  label: '1个月',
  value: 1
}, {
  label: '2个月',
  value: 2
}, {
  label: '3个月',
  value: 3
}, {
  label: '4个月',
  value: 4
}, {
  label: '5个月',
  value: 5
}, {
  label: '6个月',
  value: 6
}]

const statusSetting = [{
  label: '实习',
  value: 3
}, {
  label: '兼职',
  value: 4
}, {
  label: '劳务',
  value: 5
}, {
  label: '顾问',
  value: 6
}, {
  label: '返聘',
  value: 7
}, {
  label: '外包',
  value: 8
}]


// 附件类型
const fileType = [
  {
    name: '员工基本资料',
    typeId: 1,
    parentId: 0,
  }, {
    name: '员工档案资料',
    typeId: 2,
    parentId: 0,
  }, {
    name: '员工离职资料',
    typeId: 3,
    parentId: 0,
  }, {
    name: '员工异动材料',
    typeId: 4,
    parentId: 0,
  }, {
    name: '员工其他材料',
    typeId: 5,
    parentId: 0,
  },{
    name: '身份证原件照片',
    typeId: 11,
    parentId: 1,
  }, {
    name: '学历证明',
    typeId: 12,
    parentId: 1,
  }, {
    name: '个人证件照',
    typeId: 13,
    parentId: 1,
  }, {
    name: '身份证复印件',
    typeId: 14,
    parentId: 1,
  }, {
    name: '工资银行卡',
    typeId: 15,
    parentId: 1,
  }, {
    name: '社保卡',
    typeId: 16,
    parentId: 1,
  }, {
    name: '公积金卡',
    typeId: 17,
    parentId: 1,
  }, {
    name: '获奖证书',
    typeId: 18,
    parentId: 1,
  }, {
    name: '其他',
    typeId: 19,
    parentId: 1,
  }, {
    name: '劳动合同',
    typeId: 21,
    parentId: 2,
  }, {
    name: '入职简历',
    typeId: 22,
    parentId: 2,
  }, {
    name: '入职登记表',
    typeId: 23,
    parentId: 2,
  }, {
    name: '入职体检单',
    typeId: 24,
    parentId: 2,
  }, {
    name: '上家公司离职证明',
    typeId: 25,
    parentId: 2,
  }, {
    name: '转正申请表',
    typeId: 26,
    parentId: 2,
  }, {
    name: '其他',
    typeId: 27,
    parentId: 2,
  }, {
    name: '离职审批',
    typeId: 31,
    parentId: 3,
  }, {
    name: '离职证明',
    typeId: 32,
    parentId: 3,
  }, {
    name: '其他',
    typeId: 33,
    parentId: 3,
  }, {
    name: '任免文件',
    typeId: 41,
    parentId: 4,
  }, {
    name: '其他文件',
    typeId: 51,
    parentId: 5,
  }
]

// 非正式类型 特殊 和状态一致
const statusValue = {
  1: '正式',
  2: '试用',
  3: '实习',
  4: '兼职',
  5: '劳务',
  6: '顾问',
  7: '返聘',
  8: '外包',
  // 9: '待离职',
  // 10: '已离职',
  11: '在职',
  12: '全职',
  13: '待入职',
  14: '待离职',
  15: '已离职'
}

const validStatusValue = {
  1: '正式',
  2: '试用',
  3: '实习',
  4: '兼职',
  5: '劳务',
  6: '顾问',
  7: '返聘',
  8: '外包'
}
const healthValue = {
  '1': '健康',
  '2': '良好',
  '3': '一般',
  '4': '较差'
}
// 是否结婚
const marriageValue = {
  0: '未婚',
  1: '已婚'
}

const entryStatusValue = {
  1: "在职",
  2: "待入职",
  3: "待离职",
  4: "离职",
  5: "再入职",
  90: "入职审批中",
  91: "离职审批中",
  92: "人员调动审批中",
  93: "入职驳回"
}
const deptOrgSector = {
  1: '集团总部',
  2: '公用事业',
  3: '金融投资',
  4: '现代农业',
  5: '工程地产',
  6: '其他板块',
}

const deptUnitProperties = {
  1: '合并报表企业',
  2: '托管企业',
  3: '其他',
}
const deptOrgType = {
  1: '全资',
  2: '控股',
  3: '参股',
  4: '集体所有制',
}
// 员工model
export const employeeModel = {
  sexValue,
  birthdayTypeValue,
  idTypeValue,
  employmentFormsValue,
  probationValue,
  statusValue,
  fileType,
  validStatusValue,
  marriageValue,
  healthValue,
  getValueList,
  sexSetting,
  idTypeSetting,
  employmentFormsSetting,
  probationSetting,
  statusSetting,
  entryStatusValue,
  deptOrgSector,
  deptUnitProperties,
  deptOrgType
}

/** *** */
// 转正
import {
  hrmEmployeeQueryInAPI
} from '@/api/hrm/employee'
import {
  hrmDeptQueryTreeListAPI
} from '@/api/hrm/dept'
const officialFields = [
  {
    name: '部门',
    field: 'newDept',
    formType: 'structure',
    props: {
      dataType: 'hrm'
    },
    request: hrmDeptQueryTreeListAPI,
    setting: []
  },
  {
    name: '岗位',
    field: 'newPost',
    formType: 'text',
    setting: []
  },
  {
    name: '直属上级',
    field: 'newParentId',
    formType: 'user',
    props: { label: 'employeeName', value: 'employeeId', isList: true },
    request: hrmEmployeeQueryInAPI,
    setting: []
  },
  {
    name: '计划转正日期',
    field: 'becomeTime',
    formType: 'text',
    disabled: true,
    setting: []
  },
  {
    name: '实际转正日期',
    field: 'effectTime',
    formType: 'date',
    setting: []
  },
  {
    name: '备注',
    field: 'remarks',
    formType: 'textarea',
    setting: []
  }
]
// 转正验证规则
const officialRules = {
  effectTime: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

// 转正model
export const officialModel = {
  fields: officialFields,
  rules: officialRules
}

/** 调岗字段 */
// 1、 只有员工的“工作性质”为“实习、兼职”时，才可以“转全职员工” 3: '实习' 4: '兼职',
// 变动类型 4 转正 5调岗 6晋升 7降级 8转为全职员工
function getChangePostFields(changeType, status) {
  const changeTypeSetting = [
    { label: '调岗', value: 5 },
    { label: '晋升', value: 6 },
    { label: '降级', value: 7 }
  ]
  //  说明 1
  if (status == 3 || status == 4) {
    changeTypeSetting.push({
      label: '转为全职员工',
      value: 8
    })
  }
  // 异动原因 7 降级 与其他原因不一样
  let changeReasonList = []
  if (changeType == 7) {
    changeReasonList = [{
      label: '违规违纪',
      value: 4
    }, {
      label: '绩效不达标',
      value: 5
    }, {
      label: '个人身体原因',
      value: 6
    }, {
      label: '不适应当前岗位',
      value: 7
    }]
  } else {
    changeReasonList = [{
      label: '组织架构调整',
      value: 1
    }, {
      label: '个人申请',
      value: 2
    }, {
      label: '工作安排',
      value: 3
    }]
  }
  let temps = [
    { name: '调动类型', field: 'changeType', formType: 'select', setting: changeTypeSetting },
    { name: '调动原因', field: 'changeReason', formType: 'select', setting: changeReasonList }
  ]
  if (changeType == 8) {
    temps = temps.concat([
      { name: '入职日期', field: 'entryTime', formType: 'date', disabled: true, setting: [] },
      {
        name: '试用期',
        field: 'probation',
        formType: 'select',
        clearable: true,
        setting: [
          { label: '无试用期', value: 0 },
          { label: '1个月', value: 1 },
          { label: '2个月', value: 2 },
          { label: '3个月', value: 3 },
          { label: '4个月', value: 4 },
          { label: '5个月', value: 5 },
          { label: '6个月', value: 6 }]
      }])
  }
  return temps.concat([
    {
      name: '原单位',
      field: 'oldOrg',
      formType: 'structure',
      disabled: true,
      props: {
        dataType: 'hrm'
      },
      request: hrmDeptQueryTreeListAPI,
      params: {
        isAdmin: 1
      },
      setting: []
    },
    {
      name: '变更为',
      field: 'newOrg',
      formType: 'structure',
      props: {
        dataType: 'hrm'
      },
      request: hrmDeptQueryTreeListAPI,
      params: {
        isAdmin: 1
      },
      setting: []
    },
    {
      name: '原部门',
      field: 'oldDept',
      formType: 'structure',
      disabled: true,
      props: {
        dataType: 'hrm'
      },
      request: hrmDeptQueryTreeListAPI,
      params: {
        isAdmin: 1
      },
      setting: []
    },
    {
      name: '变更为',
      field: 'newDept',
      formType: 'structure',
      props: {
        dataType: 'hrm'
      },
      request: hrmDeptQueryTreeListAPI,
      params: {
        isAdmin: 1
      },
      setting: []
    },
    {
      name: '原职务',
      field: 'oldPost',
      formType: 'text',
      disabled: true,
      setting: []
    },
    {
      name: '变更为',
      field: 'newPost',
      formType: 'text',
      setting: []
    },
    {
      name: '原职位层级',
      field: 'oldPostLevel',
      disabled: true,
      formType: 'text',
      setting: []
    },
    {
      name: '变更为',
      field: 'newPostLevel',
      formType: 'select',
      clearable: true,
      setting: [{ "name": "集团高管正职", "value": "集团高管正职" }, { "name": "集团高管副职", "value": "集团高管副职" }, { "name": "集团高管助理", "value": "集团高管助理" }, { "name": "集团副总师", "value": "集团副总师" }, { "name": "集团中层正职", "value": "集团中层正职" }, { "name": "集团中层副职", "value": "集团中层副职" }, { "name": "集团中层助理", "value": "集团中层助理" }, { "name": "集团员工", "value": "集团员工" }, { "name": "一级公司高管正职", "value": "一级公司高管正职" }, { "name": "一级公司高管副职", "value": "一级公司高管副职" }, { "name": "一级公司高管助理", "value": "一级公司高管助理" }, { "name": "一级公司副总师", "value": "一级公司副总师" }, { "name": "一级公司中层正职", "value": "一级公司中层正职" }, { "name": "一级公司中层副职", "value": "一级公司中层副职" }, { "name": "一级公司中层助理", "value": "一级公司中层助理" }, { "name": "一级公司员工", "value": "一级公司员工" }, { "name": "二级公司高管正职", "value": "二级公司高管正职" }, { "name": "二级公司高管副职", "value": "二级公司高管副职" }, { "name": "二级公司高管助理", "value": "二级公司高管助理" }, { "name": "二级公司中层正职", "value": "二级公司中层正职" }, { "name": "二级公司中层副职", "value": "二级公司中层副职" }, { "name": "二级公司中层助理", "value": "二级公司中层助理" }, { "name": "二级公司员工", "value": "二级公司员工" }, { "name": "三级公司高管正职", "value": "三级公司高管正职" }, { "name": "三级公司高管副职", "value": "三级公司高管副职" }, { "name": "三级公司高管助理", "value": "三级公司高管助理" }, { "name": "三级公司中层正职", "value": "三级公司中层正职" }, { "name": "三级公司中层副职", "value": "三级公司中层副职" }, { "name": "三级公司中层助理", "value": "三级公司中层助理" }, { "name": "三级公司员工", "value": "三级公司员工" }, { "name": "四级公司高管正职", "value": "四级公司高管正职" }, { "name": "四级公司高管副职", "value": "四级公司高管副职" }, { "name": "四级公司高管助理", "value": "四级公司高管助理" }, { "name": "四级公司中层正职", "value": "四级公司中层正职" }, { "name": "四级公司中层副职", "value": "四级公司中层副职" }, { "name": "四级公司中层助理", "value": "四级公司中层助理" }, { "name": "四级公司员工", "value": "四级公司员工" }]
    }, {
      name: '生效日期',
      field: 'effectTime',
      formType: 'date',
      setting: []
    }, {
      name: '备注',
      field: 'remarks',
      formType: 'textarea',
      setting: []
    }])
}

// 调岗验证规则
const changePostRules = {
  effectTime: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

// 职务层级验证规则
const changePostLevelRules = {
  newPostLevel: [
    { required: true, message: '请选择', trigger: ['blur', 'change'] }
  ]
}

//职务层级调整字段
function getChangePostLevelFields() {
  return [
    {
      name: '原职位层级',
      field: 'oldPostLevel',
      disabled: true,
      formType: 'text',
      setting: []
    },
    {
      name: '变更为',
      field: 'newPostLevel',
      formType: 'select',
      clearable: true,
      setting: [{"name": "集团高管正职", "value": "集团高管正职"}, {
        "name": "集团高管副职",
        "value": "集团高管副职"
      }, {"name": "集团高管助理", "value": "集团高管助理"}, {
        "name": "集团副总师",
        "value": "集团副总师"
      }, {"name": "集团中层正职", "value": "集团中层正职"}, {
        "name": "集团中层副职",
        "value": "集团中层副职"
      }, {"name": "集团中层助理", "value": "集团中层助理"}, {
        "name": "集团员工",
        "value": "集团员工"
      }, {"name": "一级公司高管正职", "value": "一级公司高管正职"}, {
        "name": "一级公司高管副职",
        "value": "一级公司高管副职"
      }, {"name": "一级公司高管助理", "value": "一级公司高管助理"}, {
        "name": "一级公司副总师",
        "value": "一级公司副总师"
      }, {"name": "一级公司中层正职", "value": "一级公司中层正职"}, {
        "name": "一级公司中层副职",
        "value": "一级公司中层副职"
      }, {"name": "一级公司中层助理", "value": "一级公司中层助理"}, {
        "name": "一级公司员工",
        "value": "一级公司员工"
      }, {"name": "二级公司高管正职", "value": "二级公司高管正职"}, {
        "name": "二级公司高管副职",
        "value": "二级公司高管副职"
      }, {"name": "二级公司高管助理", "value": "二级公司高管助理"}, {
        "name": "二级公司中层正职",
        "value": "二级公司中层正职"
      }, {"name": "二级公司中层副职", "value": "二级公司中层副职"}, {
        "name": "二级公司中层助理",
        "value": "二级公司中层助理"
      }, {"name": "二级公司员工", "value": "二级公司员工"}, {
        "name": "三级公司高管正职",
        "value": "三级公司高管正职"
      }, {"name": "三级公司高管副职", "value": "三级公司高管副职"}, {
        "name": "三级公司高管助理",
        "value": "三级公司高管助理"
      }, {"name": "三级公司中层正职", "value": "三级公司中层正职"}, {
        "name": "三级公司中层副职",
        "value": "三级公司中层副职"
      }, {"name": "三级公司中层助理", "value": "三级公司中层助理"}, {
        "name": "三级公司员工",
        "value": "三级公司员工"
      }, {"name": "四级公司高管正职", "value": "四级公司高管正职"}, {
        "name": "四级公司高管副职",
        "value": "四级公司高管副职"
      }, {"name": "四级公司高管助理", "value": "四级公司高管助理"}, {
        "name": "四级公司中层正职",
        "value": "四级公司中层正职"
      }, {"name": "四级公司中层副职", "value": "四级公司中层副职"}, {
        "name": "四级公司中层助理",
        "value": "四级公司中层助理"
      }, {"name": "四级公司员工", "value": "四级公司员工"}]
    }]
}

// 调岗model
export const changePostModel = {
  fieldsFunc: getChangePostFields,
  rules: changePostRules
}

// 职务层级调整model
export const changePostLevelModel = {
  fieldsFunc: getChangePostLevelFields,
  rules: changePostLevelRules
}

